import React,{Component} from 'react';
import axios from 'axios'
import {HashRouter as Router,Route,NavLink,Redirect,Switch,WithRouter, withRouter} from 'react-router-dom'
import loadable from '../util/loadable'
const Mytaobao = loadable(()=>import('./Mytaobao'))
class Xq extends Component{
    constructor(){
        super();
        this.state={
            list:[]
        }   
    }
    componentDidMount(){
       axios.get('/data.json').then((res)=>{
           let arr= res.data.dataimg.filter((item)=>{
                return item.id==this.props.match.params.id
            })
           this.setState({
               list:arr
           },()=>{
           })
       })
    }
    tui=()=>{
        localStorage.clear()
        this.props.history.push('/Login')
    }
    render(){
        const {list} = this.state
        return(
            <div className="xq">
                <div className="xq-img">
                    {
                        list.map((item)=>{
                            return <img src={item.img} key={item.id}/>
                        })
                    }
                </div>
                <button className="btn" onClick={this.tui}>退出登录</button>
            </div>
        )
    }
}
export default withRouter(Xq)